package com.cskaoyan.javase.oop2.encapsulate._1extends._7initialization._2classload;

/**
 * 继承中父子类的类加载顺序:
 *      "先父后子"
 * 注意:
 *      1.从最顶层的父类开始,往下进行类加载,直到类加载到触发类加载的子类
 *      2.只要触发子类类加载,不管何种方式,都要先类加载它的父类
 *
 * @since 10:57
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo {
    public static void main(String[] args) {
        new Grandson();
        // new Son();
    }
}

class Grandfather {
    static {
        System.out.println("grandfather");
    }
}

class Father extends Grandfather {
    static {
        System.out.println("father");
    }
}

class Son extends Father {
    static {
        System.out.println("son");
    }

    public void test(){
    }
}

class Grandson extends Son {
    static {
        System.out.println("grandson");
    }
}
